package jp.sinya;

import javax.servlet.*;
import java.io.IOException;
import java.util.Enumeration;

public class DemoServlet implements Servlet {
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        System.out.println("init...");
        System.out.println(servletConfig.getInitParameter("param1"));
        System.out.println(servletConfig.getInitParameter("param2"));

        //获取所有初始化参数的名称
        Enumeration<String> enumList = servletConfig.getInitParameterNames();
        while (enumList.hasMoreElements()) {
            System.out.println(enumList.nextElement());
        }
    }

    @Override
    public ServletConfig getServletConfig() {
        System.out.println("getServletConfig...");
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("service...");
    }

    @Override
    public String getServletInfo() {
        System.out.println("getServletInfo...");
        return null;
    }

    @Override
    public void destroy() {
        System.out.println("destroy...");
    }
}
